package com.hjh10.websocket.socket;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * 开启WebSocket支持
 *
 * @author 潘浩
 */
@Configuration
public class WebSocketConfig{

    /**
     * ServerEndpointExporter作用
     *
     * 这个Bean会自动注册使用@ServerEndpoint注解声明的websocket endpoint
     *
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {

        System.out.println("====== 开启WebSocket ======= ");
        return new ServerEndpointExporter();
    }

}
